package com.hsomandroidapp.util;

import android.util.Log;

import com.hsomandroidapp.entity.Product;
import com.hsomandroidapp.org.json.JSONException;
import com.hsomandroidapp.org.json.JSONObject;

public class DataUtils {

	public static Product cartJson2Product(JSONObject cart){
		Product prod = new Product();
		try{
			prod.setContent(cart.getString("goodsName"));
			prod.setProductId(cart.getString("goodsId"));
			prod.setProductNo(cart.getString("goodsNo"));
			prod.setRealPrice(cart.getString("price"));
			prod.setProductId(cart.getString("goodsId"));
			prod.setNums(cart.getInt("itemNo"));
		}catch(JSONException e){
			Log.e("JSON", e.getMessage());
		}
		
		return prod;	
		
	}
}
